package com.example.a12138.myapplication.model;

import com.alibaba.fastjson.JSON;

public class Main {
    public static void main(String[] args){
        Result<Book> result=new Result<>();
        result.setCode(1);
        result.setMsg("success");
        Book book=new Book();
        book.setBook_id(1);
        book.setContent("小班语言");
        book.setImg_url("http://122.112.245.136:5555/Public/images/realinfo/2018-08-28/5b84d120685ac.png");
        result.setData(book);
        String jsonString=JSON.toJSONString(result);
        System.out.println(jsonString);
    }


    public static void main2(String[] args){
        String jsonString="{\"code\":1,\"data\":{\"book_id\":1,\"content\":\"小班语言\",\"img_url\":\"http://122.112.245.136:5555/Public/images/realinfo/2018-08-28/5b84d120685ac.png\",\"time\":0},\"msg\":\"success\"}";
        String str="{\"book_id\":1,\"content\":\"小班语言\",\"img_url\":\"http://122.112.245.136:5555/Public/images/realinfo/2018-08-28/5b84d120685ac.png\",\"time\":0}";
        Book book= JSON.parseObject(str,Book.class);
        System.out.print(book.getBook_id());


    }

}
